<template>
	<div class="addVideo">
		<el-dialog
			title="退费确认"
			:visible.sync="dialogVisible"
			width="600px"
			:modal-append-to-body="false"
			:close-on-click-modal="false"
			custom-class="custom-dialog"
		>
			<el-form
				ref="forms"
				size="small"
				:model="forms"
				:rules="rules"
				label-width="110px"
				label-position="right"
			>
				<el-form-item label="商品名称：" prop="goodsname">
					<el-input v-model="forms.goodsname" style="width: 100%" disabled />
				</el-form-item>
				<el-form-item label="联系人：" prop="linkman">
					<el-input v-model="forms.linkman" style="width: 100%" disabled />
				</el-form-item>
				<el-form-item label="联系方式：" prop="linkphone">
					<el-input v-model="forms.linkphone" style="width: 100%" disabled />
				</el-form-item>
				<el-form-item label="联系公司：" prop="linkcompany">
					<el-input v-model="forms.linkcompany" style="width: 100%" disabled />
				</el-form-item>
				<el-form-item label="订单状态：" prop="order_type">
					<el-select v-model="forms.order_type" placeholder="请选择" style="width: 200px" clearable>
						<el-option label="审核通过" value="2" />
						<el-option label="审核拒绝" value="4" />
					</el-select>
				</el-form-item>
				<el-form-item label="拒绝原因：" prop="check_rerson">
					<el-input
						v-model="forms.check_rerson"
						placeholder="请输入拒绝原因"
						clearable
						type="textarea"
						maxlength="100"
						show-word-limit
						style="width: 100%"
					/>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button style="margin-right: 5px" @click="dialogVisible = false">取消</el-button>
				<el-button type="primary" @click="saveVideos">确定</el-button>
			</span>
		</el-dialog>
	</div>
</template>
<script>
	import { orderShenhe } from '@/api/order.js'
	export default {
		name: 'OrderShenhe',
		data() {
			return {
				dialogVisible: false,
				disabled: false,
				forms: {},
				rules: {
					check_rerson: [{ required: true, message: '请输入拒绝原因', trigger: 'change' }],
					order_type: [{ required: true, message: '请选择审核意见', trigger: 'change' }]
				}
			}
		},
		methods: {
			initData(info) {
				this.dialogVisible = true
				this.forms = {
					id: info.id,
					goodsname: info.goodsname,
					linkphone: info.linkphone,
					linkcompany: info.linkcompany,
					linkman: info.linkman,
					order_type: '',
					order_des: ''
				}
				this.$nextTick(() => {
					this.$refs.forms.clearValidate()
				})
			},
			// 保存
			async saveVideos() {
				this.$refs.forms.validate(async valid => {
					if (valid) {
						const loading = this.$loading({
							lock: true,
							text: '数据提交中~'
						})
						orderShenhe(this.forms).then(
							res => {
								this.$message.success(`订单审批提交成功！`)
								this.dialogVisible = false
								this.$parent.loadData()
								loading.close()
							},
							err => {
								loading.close()
							}
						)
					}
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.addVideo {
		::v-deep {
			.el-dialog .el-dialog__body {
				padding-bottom: 20px;
			}
			.el-form-item--small .el-form-item__label {
				line-height: 36px;
			}
		}
		.box-wrap {
			display: flex;
			align-items: center;
			flex-wrap: wrap;
		}
	}
</style>
